yl = yl or {}
yl.UNIT                                 = "金币"
yl.btscale                              = 0.96
yl.WIDTH								= 1334--1136--1334
yl.HEIGHT								= 750--640--750

yl.DEVICE_TYPE							= 0x10
yl.KIND_ID								= 122
yl.STATION_ID							= 1

yl.land = 100       --斗地主
yl.zjh = 101        --诈金花
yl.oxbattle = 102    --百人牛牛
yl.oxnew = 103      --抢庄牛牛
yl.balckred = 104   --红黑大战
yl.longhudou = 105   --龙虎斗
yl.baccaratnew = 106 --百家乐
yl.buyu = 107
yl.football = 108
yl.sparrowtwo = 109	--2人麻将
yl.sharkbattle = 110 --飞禽走兽
yl.sparrowxl = 112	--血流麻将
yl.bcbm = 111  --奔驰宝马
yl.runfasthn = 113  --跑得快
yl.fruitslot = 119  --水果机
yl.csdslot = 120  	--财神到
yl.dezhoupuke = 118  --德州扑克

yl.baccaratnew_video = 121  --视频百家乐

yl.US_NULL								= 0x00		--没有状态
yl.US_FREE								= 0x01		--站立状态
yl.US_SIT								= 0x02		--坐下状态
yl.US_READY								= 0x03		--同意状态
yl.US_LOOKON							= 0x04		--旁观状态
yl.US_PLAYING					 		= 0x05		--游戏状态
yl.US_OFFLINE							= 0x06		--断线状态

yl.INVALID_TABLE						= 65535
yl.INVALID_CHAIR						= 65535
yl.INVALID_ITEM							= 65535
yl.INVALID_USERID						= 0			--无效用户
yl.INVALID_BYTE                         = 255
yl.INVALID_WORD                         = 65535

yl.backgroudId							= -1

yl.updateList = {}   --下载小游戏列表

yl.DOWN_PRO_INFO						= 1
yl.DOWN_UNZIP_STATUS					= 2
yl.DOWN_COMPELETED						= 3
yl.DOWN_ERROR_PATH						= 4 									--路径出错
yl.DOWN_ERROR_CREATEFILE				= 5 									--文件创建出错
yl.DOWN_ERROR_CREATEURL					= 6 									--创建连接失败
yl.DOWN_ERROR_NET		 				= 7 									--下载失败
yl.DOWN_ERROR_UNZIP 					= 8

yl.SCENE_GAMELIST 						= 1
yl.SCENE_ROOMLIST 						= 2
yl.SCENE_USERINFO 						= 3
yl.SCENE_BANK							= 4
yl.SCENE_OPTION							= 5
yl.SCENE_RANKINGLIST					= 6
yl.SCENE_BANKRECORD						= 8
yl.SCENE_ORDERRECORD					= 10
yl.SCENE_EVERYDAY						= 11
yl.SCENE_CHECKIN						= 12
yl.SCENE_TASK							= 13
yl.SCENE_AGENT							= 14
yl.SCENE_ROOM  							= 20
yl.SCENE_GAME 							= 21
yl.SCENE_SHOP							= 22
yl.SCENE_SHOPDETAIL						= 23
yl.SCENE_BAG							= 24
yl.SCENE_BAGDETAIL						= 25
yl.SCENE_BAGTRANS						= 26
yl.SCENE_BINDING						= 27
yl.SCENE_FRIEND							= 28
yl.SCENE_MODIFY							= 29		--密码修改
yl.SCENE_TABLE							= 30		--转盘界面
yl.SCENE_FEEDBACK					 	= 31		--反馈界面
yl.SCENE_FEEDBACKLIST				 	= 32		--反馈列表
yl.SCENE_FAQ							= 33		--常见问题
yl.SCENE_BINDINGREG						= 34		--绑定注册
yl.SCENE_Recharge						= 35
yl.SCENE_NOTICE							= 36		--绑定手机
yl.SCENE_GAMENOTICE							= 37		--游戏公告yl.INVALID_TABLE						= 65535
yl.SCENE_KEFU                           = 38
yl.SCENE_TUIGUAN                           = 39

yl.INVALID_CHAIR						= 65535
yl.INVALID_ITEM							= 65535
yl.INVALID_USERID						= 0			--无效用户
yl.INVALID_BYTE                         = 255
yl.INVALID_WORD                         = 65535--头像信息
yl.FACE_CX 								= 48
yl.FACE_CY								= 48

yl.GENDER_FEMALE						= 0				--女性性别
yl.GENDER_MANKIND						= 1				--男性性别

yl.GAME_GENRE_GOLD						= 0x0001		--金币类型
yl.GAME_GENRE_SCORE						= 0x0002		--点值类型
yl.GAME_GENRE_MATCH						= 0x0004		--比赛类型
yl.GAME_GENRE_EDUCATE					= 0x0008		--训练类型
yl.GAME_GENRE_PERSONAL 					= 0x0010 		-- 约战类型

yl.SERVER_GENRE_PASSWD					= 0x0002 		-- 密码类型

yl.SR_ALLOW_AVERT_CHEAT_MODE			= 0x00000040	--隐藏信息

yl.LEN_GAME_SERVER_ITEM					= 183			--房间长度
--yl.LEN_GAME_SERVER_ITEM					= 177			--房间长度
yl.LEN_TASK_PARAMETER					= 813			--任务长度
yl.LEN_TASK_STATUS						= 5             --任务长度

yl.LEN_MD5								= 33			--加密密码
yl.LEN_ACCOUNTS							= 32			--帐号长度
yl.LEN_NICKNAME							= 32			--昵称长度
yl.LEN_PASSWORD							= 33			--密码长度
yl.LEN_USER_UIN							= 33
yl.LEN_QQ                               = 16            --Q Q 号码
yl.LEN_EMAIL                            = 33            --电子邮件
yl.LEN_COMPELLATION 					= 16			--真实名字
yl.LEN_SEAT_PHONE                       = 33            --固定电话
yl.LEN_MOBILE_PHONE                     = 12            --移动电话
yl.LEN_PASS_PORT_ID                     = 19            --证件号码
yl.LEN_COMPELLATION                     = 16            --真实名字
yl.LEN_DWELLING_PLACE                   = 128           --联系地址
yl.LEN_UNDER_WRITE                      = 32            --个性签名
yl.LEN_PHONE_MODE                       = 21            --手机型号
yl.LEN_SERVER                           = 32            --房间长度
yl.LEN_TRANS_REMARK						= 32			--转账备注
yl.LEN_TASK_NAME						= 64			--任务名称

yl.LEN_MOBILE_PHONE						= 12			--移动电话
yl.LEN_COMPELLATION						= 16			--真实名字
yl.LEN_MACHINE_ID						= 33			--序列长度
yl.LEN_USER_CHAT						= 128			--聊天长度
yl.SOCKET_TCP_BUFFER					= 16384			--网络缓冲

yl.MDM_GP_LOGON							= 1				--广场登录
yl.MDM_MB_LOGON							= 100			--广场登录

yl.SUB_MB_LOGON_ACCOUNTS				= 2				--帐号登录
yl.SUB_MB_REGISTER_ACCOUNTS 			= 3				--注册帐号
yl.SUB_MB_LOGON_VISITOR					= 5             --游客登录

yl.SUB_MB_LOGON_SUCCESS					= 1				--登录成功
yl.SUB_MB_LOGON_FAILURE					= -5			--登录失败
yl.SUB_MB_UPDATE_NOTIFY					= 200			--升级提示


yl.MDM_MB_SERVER_LIST					= 101			--列表信息

yl.SUB_MB_LIST_KIND						= 100			--种类列表
yl.SUB_MB_LIST_SERVER					= 101			--房间列表
yl.SUB_MB_LIST_FINISH					= 200			--列表完成

yl.SUB_MB_AGENT_KIND					= 400			--代理列表


yl.MDM_GP_USER_SERVICE					= 3 			--用户服务

yl.SUB_GP_MODIFY_LOGON_PASS				= 101			--修改密码
yl.SUB_GP_MODIFY_INSURE_PASS			= 102			--修改密码
yl.SUB_GP_MODIFY_UNDER_WRITE			= 103			--修改签名

--修改头像
yl.SUB_GP_USER_FACE_INFO				= 120			--头像信息
yl.SUB_GP_SYSTEM_FACE_INFO				= 122			--系统头像
yl.SUB_GP_CUSTOM_FACE_INFO				= 123			--自定义头像

yl.SUB_GP_USER_INDIVIDUAL				= 140			--个人资料
yl.SUB_GP_QUERY_INDIVIDUAL				= 141			--查询信息
yl.SUB_GP_MODIFY_INDIVIDUAL				= 152			--修改资料

yl.SUB_GP_USER_ENABLE_INSURE		    = 160			--开通银行
yl.SUB_GP_USER_SAVE_SCORE				= 161			--存款操作
yl.SUB_GP_USER_TAKE_SCORE				= 162			--取款操作
yl.SUB_GP_USER_INSURE_INFO				= 164			--银行资料
yl.SUB_GR_USER_TRANSFER_SCORE  			= 163 			--转帐操作
yl.SUB_GP_QUERY_INSURE_INFO				= 165			--查询银行
yl.SUB_GP_USER_INSURE_SUCCESS			= 166			--银行成功
yl.SUB_GP_USER_INSURE_FAILURE			= 167			--银行失败
yl.SUB_GP_USER_INSURE_ENABLE_RESULT 	= 170			--开通结果

yl.SUB_GP_OPERATE_SUCCESS				= 500			--操作成功
yl.SUB_GP_OPERATE_FAILURE				= 501			--操作失败


yl.DTP_GP_UI_NICKNAME					= 2				--用户昵称
yl.DTP_GP_UI_UNDER_WRITE				= 3				--个性签名
yl.DTP_GP_MODIFY_UNDER_WRITE			= 4

yl.DTP_GP_MEMBER_INFO					= 2 			--会员信息

yl.SUB_GP_GROWLEVEL_QUERY				= 300			--查询等级
yl.SUB_GP_GROWLEVEL_PARAMETER			= 301			--等级参数
yl.SUB_GP_GROWLEVEL_UPGRADE				= 302			--等级升级

yl.SUB_GP_TASK_LOAD						= 240			--任务加载
yl.SUB_GP_TASK_TAKE						= 241			--任务领取
yl.SUB_GP_TASK_REWARD					= 242			--任务奖励
yl.SUB_GP_TASK_GIVEUP					= 243			--任务放弃
yl.SUB_GP_TASK_INFO						= 250			--任务信息
yl.SUB_GP_TASK_LIST						= 251			--任务信息
yl.SUB_GP_TASK_RESULT					= 252			--任务结果
yl.SUB_GP_TASK_GIVEUP_RESULT			= 253			--放弃结果

--低保服务
yl.SUB_GP_BASEENSURE_LOAD				= 260			--加载低保
yl.SUB_GP_BASEENSURE_TAKE				= 261			--领取低保
yl.SUB_GP_BASEENSURE_PARAMETER			= 262			--低保参数
yl.SUB_GP_BASEENSURE_RESULT				= 263			--低保结果

--帐号绑定
yl.SUB_GP_ACCOUNT_BINDING				= 380			--注册绑定
yl.SUB_GP_ACCOUNT_BINDING_EXISTS		= 381			--帐号绑定

yl.MDM_GR_LOGON							= 1				--登录信息
yl.SUB_GR_LOGON_MOBILE					= 2				--手机登录

yl.SUB_GR_LOGON_SUCCESS					= 100			--登录成功
yl.SUB_GR_LOGON_FAILURE					= 101			--登录失败
yl.SUB_GR_LOGON_FINISH					= 102			--登录完成

yl.SUB_GR_UPDATE_NOTIFY					= 200			--升级提示


yl.MDM_GR_CONFIG						= 2				--配置信息
yl.SUB_GR_CONFIG_COLUMN					= 100			--列表配置
yl.SUB_GR_CONFIG_SERVER					= 101			--房间配置
yl.SUB_GR_CONFIG_FINISH					= 102			--配置完成

yl.MDM_GR_USER							= 3				--用户信息

yl.SUB_GR_USER_SITDOWN					= 3				--坐下请求
yl.SUB_GR_USER_STANDUP					= 4				--起立请求

yl.SUB_GR_USER_CHAIR_REQ 	   			= 10 			--请求更换位置
yl.SUB_GR_USER_CHAIR_INFO_REQ 	 		= 11 			--请求椅子用户信息

yl.SUB_GR_USER_ENTER					= 100			--用户进入
yl.SUB_GR_USER_SCORE					= 101			--用户分数
yl.SUB_GR_USER_STATUS					= 102			--用户状态
yl.SUB_GR_REQUEST_FAILURE				= 103			--请求失败
yl.SUB_GR_USER_GAME_DATA				= 104			--用户游戏数据

yl.SUB_GR_USER_CHAT						= 201			--聊天消息
yl.SUB_GR_USER_EXPRESSION				= 202			--表情消息
yl.SUB_GR_WISPER_CHAT					= 203			--私聊消息
yl.SUB_GR_WISPER_EXPRESSION				= 204			--私聊表情
yl.SUB_GR_COLLOQUY_CHAT					= 205			--会话消息
yl.SUB_GR_COLLOQUY_EXPRESSION			= 206			--会话表情

yl.MDM_GF_FRAME							= 100    		--框架命令

yl.SUB_GF_GAME_OPTION					= 1				--游戏配置
yl.SUB_GF_USER_READY					= 2				--用户准备
yl.SUB_GF_LOOKON_CONFIG					= 3				--旁观配置

yl.SUB_GF_GAME_STATUS					= 100			--游戏状态
yl.SUB_GF_GAME_SCENE					= 101			--游戏场景
yl.SUB_GF_LOOKON_STATUS					= 102			--旁观状态

yl.SUB_GF_SYSTEM_MESSAGE				= 200			--系统消息
yl.SUB_GF_ACTION_MESSAGE				= 201			--动作消息

yl.MDM_GR_STATUS						= 4				--状态信息

yl.SUB_GR_TABLE_INFO					= 100			--桌子信息
yl.SUB_GR_TABLE_STATUS					= 101			--桌子状态

yl.MDM_GF_GAME							= 200			--游戏命令

yl.DTP_GR_TABLE_PASSWORD				= 1				--桌子密码
yl.DTP_GR_NICK_NAME						= 10			--用户昵称
yl.DTP_GR_UNDER_WRITE					= 12 			--个性签名

yl.REQUEST_FAILURE_NORMAL				= 0				--常规原因
yl.REQUEST_FAILURE_NOGOLD				= 1				--金币不足
yl.REQUEST_FAILURE_NOSCORE				= 2				--积分不足
yl.REQUEST_FAILURE_PASSWORD				= 3				--密码错误

yl.MDM_CM_SYSTEM						= 1000			--系统命令

ylSUB_CM_SYSTEM_MESSAGE					= 1				--系统消息
ylSUB_CM_ACTION_MESSAGE					= 2				--动作消息

yl.SMT_CHAT								= 0x0001		--聊天消息
yl.SMT_EJECT							= 0x0002		--弹出消息
yl.SMT_GLOBAL							= 0x0004		--全局消息
yl.SMT_PROMPT							= 0x0008		--提示消息
yl.SMT_TABLE_ROLL						= 0x0010		--滚动消息

yl.SMT_CLOSE_ROOM						= 0x0100		--关闭房间
yl.SMT_CLOSE_GAME						= 0x0200		--关闭游戏
yl.SMT_CLOSE_LINK						= 0x0400		--中断连接
yl.SMT_CLOSE_INSURE						= 0x0800		--关闭银行

--任务类型
yl.TASK_TYPE_WIN_INNINGS				= 0x01			--赢局任务
yl.TASK_TYPE_SUM_INNINGS				= 0x02			--总局任务
yl.TASK_TYPE_FIRST_WIN					= 0x04			--首胜任务
yl.TASK_TYPE_JOIN_MATCH					= 0x08			--比赛任务

--任务状态
yl.TASK_STATUS_UNFINISH					= 0				--任务状态
yl.TASK_STATUS_SUCCESS					= 1				--任务成功
yl.TASK_STATUS_FAILED					= 2				--任务失败
yl.TASK_STATUS_REWARD					= 3				--领取奖励
yl.TASK_STATUS_WAIT						= 4 			--等待领取

--任务数量
yl.TASK_MAX_COUNT						= 128			--任务数量

--签到服务
yl.SUB_GP_CHECKIN_QUERY					= 220			--查询签到
yl.SUB_GP_CHECKIN_INFO					= 221			--签到信息
yl.SUB_GP_CHECKIN_DONE					= 222			--执行签到
yl.SUB_GP_CHECKIN_RESULT				= 223			--签到结果

--会员服务
yl.SUB_GP_MEMBER_PARAMETER				= 340			--会员参数
yl.SUB_GP_MEMBER_QUERY_INFO				= 341			--会员查询
yl.SUB_GP_MEMBER_DAY_PRESENT			= 342			--会员送金
yl.SUB_GP_MEMBER_DAY_GIFT				= 343			--会员礼包
yl.SUB_GP_MEMBER_PARAMETER_RESULT		= 350			--参数结果
yl.SUB_GP_MEMBER_QUERY_INFO_RESULT		= 351			--查询结果
yl.SUB_GP_MEMBER_DAY_PRESENT_RESULT		= 352			--送金结果
yl.SUB_GP_MEMBER_DAY_GIFT_RESULT		= 353			--礼包结果



--平台id列表(服务器登陆用)
yl.PLATFORM_LIST = {}


yl.MAX_INT                              = 2 ^ 15
--是否动态加入
yl.m_bDynamicJoin                       = false
--设备类型
yl.DEVICE_TYPE_LIST = {}
yl.DEVICE_TYPE_LIST[cc.PLATFORM_OS_WINDOWS] 	= 0x00
yl.DEVICE_TYPE_LIST[cc.PLATFORM_OS_ANDROID] 	= 0x11
yl.DEVICE_TYPE_LIST[cc.PLATFORM_OS_IPHONE] 	= 0x31
yl.DEVICE_TYPE_LIST[cc.PLATFORM_OS_IPAD] 	= 0x41

--右移
function yl.rShiftOp(left,num)
	return math.floor(left / (2 ^ num))
end

--左移
function yl.lShiftOp(left, num)
	return left * (2 ^ num)
end


function yl.tab_cutText(str)
	local list = {}
	local len = string.len(str)
	local i = 1
	while i <= len do
		local c = string.byte(str, i)
		local shift = 1
		if c > 0 and c <= 127 then
			shift = 1
		elseif (c >= 192 and c <= 223) then
			shift = 2
		elseif (c >= 224 and c <= 239) then
			shift = 3
		elseif (c >= 240 and c <= 247) then
			shift = 4
		end
		local char = string.sub(str, i, i+shift-1)
		i = i + shift
		table.insert(list, char)
	end
	return list, len
end

function yl.stringCount(szText)
	
	local i = 1
	local nCount = 0
	
	if szText ~= nil then
		--文本长度
		while true do
			local cur = string.sub(szText,i)
			local c = string.byte(cur)
			if c == nil then
				break
			end
			if c > 0 and c <= 127 then
				i = i + 1
			elseif (c >= 192 and c <= 223) then
				i = i + 2
			elseif (c >= 224 and c <= 239) then
				i = i + 3
			elseif (c >= 240 and c <= 247) then
				i = i + 4
			else
				i = i + 1
			end
			nCount = nCount + 1
			-- if byte > 128 then
			-- 	i = i + 3
			-- else
			-- 	i = i + 1
			-- end
			-- nCount = nCount + 1
		end
	end
	
	return nCount
end

function string.getConfig(fontfile,fontsize)
	local config = {}
	local tmpEN = cc.LabelTTF:create("A", fontfile, fontsize)
	local tmpCN = cc.LabelTTF:create("网", fontfile, fontsize)
	local tmpen = cc.LabelTTF:create("a", fontfile, fontsize)
	local tmpNu = cc.LabelTTF:create("2", fontfile, fontsize)
	config.upperEnSize = tmpEN:getContentSize().width
	config.cnSize = tmpCN:getContentSize().width
	config.lowerEnSize = tmpen:getContentSize().width
	config.numSize = tmpNu:getContentSize().width
	return config
end

function string.EllipsisByConfig(szText, maxWidth,config)
	if not config then
		return szText
	end
	--当前计算宽度
	local width = 0
	--截断结果
	local szResult = "..."
	--完成判断
	local bOK = false
	
	local i = 1
	
	local endwidth = 3*config.numSize
	
	while true do
		local cur = string.sub(szText,i,i)
		local byte = string.byte(cur)
		if byte == nil then
			break
		end
		if byte > 128 then
			if width <= maxWidth - endwidth then
				width = width + config.cnSize
				i = i + 3
			else
				bOK = true
				break
			end
			elseif	byte ~= 32 then
			if width <= maxWidth - endwidth then
				if string.byte('A') <= byte and byte <= string.byte('Z') then
					width = width + config.upperEnSize
				elseif string.byte('a') <= byte and byte <= string.byte('z') then
					width = width + config.lowerEnSize
				else
					width = width + config.numSize
				end
				i = i + 1
			else
				bOK = true
				break
			end
		else
			i = i + 1
		end
	end
	
	if i ~= 1 then
		szResult = string.sub(szText, 1, i-1)
		if (bOK) then
			szResult = szResult.."..."
		end
	end
	return szResult
end

--依据宽度截断字符
function string.stringEllipsis(szText, sizeE,sizeCN,maxWidth)
	--当前计算宽度
	local width = 0
	--截断结果
	local szResult = "..."
	--完成判断
	local bOK = false
	
	local i = 1
	
	while true do
		local cur = string.sub(szText,i,i)
		local byte = string.byte(cur)
		if byte == nil then
			break
		end
		if byte > 128 then
			if width <= maxWidth - 3*sizeE then
				width = width + sizeCN
				i = i + 3
			else
				bOK = true
				break
			end
			elseif	byte ~= 32 then
			if width <= maxWidth - 3*sizeE then
				width = width +sizeE
				i = i + 1
			else
				bOK = true
				break
			end
		else
			i = i + 1
		end
	end
	
	if i ~= 1 then
		szResult = string.sub(szText, 1, i-1)
		if (bOK) then
			szResult = szResult.."..."
		end
	end
	return szResult
end


function yl.getLevelDescribe(lScore)
	local lLevelScore = { 2000, 4000, 8000, 20000, 40000, 80000, 150000, 300000, 500000, 1000000, 2000000, 5000000, 10000000, 50000000, 100000000, 500000000, 1000000000 };
	local lLevelDesc={ "务农","佃户","雇工","作坊主","农场主","地主","大地主","财主","富翁","大富翁","小财神","大财神","赌棍","赌侠","赌王","赌圣","赌神","职业赌神"}
	for i=#lLevelScore ,1,-1 do
		if lScore >= lLevelScore[i] then
			return lLevelDesc[i]
		end
	end
	return lLevelDesc[1]
end

local poker_data =
{
0x00,
0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, -- 方块
0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, -- 梅花
0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2A, 0x2B, 0x2C, 0x2D, -- 红桃
0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3A, 0x3B, 0x3C, 0x3D, -- 黑桃
0x4E, 0x4F
}
-- 逻辑数值
yl.POKER_VALUE = {}
-- 逻辑花色
yl.POKER_COLOR = {}
-- 纹理花色
yl.CARD_COLOR = {}
function yl.GET_POKER_VALUE()
	for k,v in pairs(poker_data) do
		yl.POKER_VALUE[v] = math.mod(v, 16)
		yl.POKER_COLOR[v] = bit:_and(v , 0XF0)
		yl.CARD_COLOR[v] = math.floor(v / 16)
	end
end
yl.GET_POKER_VALUE()

--第三方平台定义(同java/ios端定义值一致)
yl.ThirdParty = 
{
	WECHAT 								= 1,	--微信
	QQ                                  = 2,    --QQ
	ALIPAY								= 3,	--支付宝
	WECHAT_CIRCLE						= 1,	--朋友圈
	JFT								 	= 3,	--俊付通
	AMAP 								= 4,	--高德地图
	IAP 							 	= 5,	--ios iap
	SMS                                 = 6,    --分享到短信
}

yl.ThirdPartyURL = 
{
	[1] 								= "weixin://",	--微信
	[2]                                 = "mqqapi://",    --QQ
	[3]									= "alipay://",	--支付宝
	WECHAT_CIRCLE						= 1,	--朋友圈
	JFT								 	= 3,	--俊付通
	AMAP 								= 4,	--高德地图
	IAP 							 	= 5,	--ios iap
	SMS                                 = 6,    --分享到短信
}


yl.GAME_NOTICE_DESCR = {
	[yl.land] = "恭喜x在x一把赢得x！",
	[yl.zjh] ="恭喜x在x中拿到x一把赢得x！",
	[yl.oxbattle] = "恭喜！x在x中一把赢了x！",
	[yl.oxnew] = "恭喜x在x中拿到x一把赢得x！",
	[yl.balckred] = "恭喜！x在x中一把赢了x！",
	[yl.longhudou] = "恭喜！x在x中一把赢了x！" ,
	[yl.baccaratnew] = "恭喜！x在x中一把赢了x！",
	[yl.buyu] = "恭喜！x在x中一把赢了x！",
	[yl.sparrowtwo] = "恭喜！x在x中一把赢了x！",
	[yl.sharkbattle] = "恭喜！x在x中一把赢了x！",
	[yl.sparrowxl] = "恭喜！x在x中一把赢了x！",
	[yl.bcbm] = "恭喜！x在x中一把赢了x！",
	[yl.runfasthn] = "恭喜！x在x中一把赢了x！",
	[yl.dezhoupuke] = "恭喜！x在x中一把赢了x！",
	[yl.fruitslot] = "恭喜！x在x中获得jackpot彩池赢了x！",
	
}
yl.GAME_TYPE_DUIZHAN = 
{
	[yl.land] = "斗地主",
	[yl.zjh] ="炸金花",
	[yl.buyu] = "捕鱼",
	[yl.sparrowtwo] = "二人麻将",
	[yl.sparrowxl] = "血流麻将",
	[yl.runfasthn] = "跑得快",
	[yl.dezhoupuke] = "德州扑克",
}
yl.GAME_TYPE_BAIREN = 
{
	[yl.oxbattle] = "百人牛牛",
	[yl.balckred] = "红黑大战",
	[yl.longhudou] = "龙虎斗" ,
	[yl.baccaratnew] = "百家乐",
	[yl.sharkbattle] = "狮子王国",
	[yl.bcbm] = "奔驰宝马",
	[yl.baccaratnew_video] = "视讯百家乐",
}
yl.GAME_NOTICE_TYPE = {
	[yl.land] = "斗地主",
	[yl.zjh] ="炸金花",
	[yl.oxbattle] = "百人牛牛",
	[yl.oxnew] = "抢庄牛牛",
	[yl.balckred] = "红黑大战",
	[yl.longhudou] = "龙虎斗" ,
	[yl.baccaratnew] = "百家乐",
	[yl.buyu] = "捕鱼",
	[yl.sparrowtwo] = "二人麻将",
	[yl.sharkbattle] = "狮子王国",
	[yl.sparrowxl] = "血流麻将",
	[yl.bcbm] = "奔驰宝马",
	[yl.runfasthn] = "跑得快",
	[yl.dezhoupuke] = "德州扑克",
	[yl.fruitslot] = "水果机",
	[yl.baccaratnew_video] = "视讯百家乐",
	
}

yl.GAME_NOTICE_CARD_TYPE = {
	[yl.land] = "",
	[yl.zjh] ={"散牌","对子","顺子","金花","顺金","豹子"},
	[yl.oxbattle] = {"无牛","牛一","牛二","牛三","牛四","牛五","牛六","牛七","牛八","牛九","牛牛"},
	[yl.oxnew] = {"无牛","牛一","牛二","牛三","牛四","牛五","牛六","牛七","牛八","牛九","牛牛"},
	[yl.balckred] = {"散牌","对子","顺子","金花","顺金","豹子"},
	[yl.longhudou] = "" ,
	[yl.baccaratnew] = "",
	[yl.buyu] = "",
	[yl.sparrowtwo] = "",
	[yl.sharkbattle] = "",
	[yl.bcbm] = "",
	[yl.sparrowxl] = "",
	[yl.dezhoupuke] = "",
}


yl.PAY_DEVICE_TYPE = {
	ios = 1,
	android = 2,
	windows = 3
}

yl.CHAT_LAB_LIST =  {
"和你合作真是太愉快了！",
"不怕神一样的对手，就怕猪一样的队友。",
"快点吧，我等得花也谢了。",
"你快出啊，你下崽啊？！",
"哎呀！这底牌要是被我拿着就没谁了。",
"我的天哪，整个儿一悲剧啊。",
"天哪，跪求悔牌。",
"唉，这手臭牌可咋整啊…"
}

--聊天CD时间
yl.CHAT_WIAT_TIME = 0
yl.CHAT_WIAT_MAX = 5 *60

yl.EVENT_TRY_CONNECTED = "EVENT_TRY_CONNECTED"
yl.EVENT_CALL_BACKGROUND = "EVENT_CALL_BACKGROUND"


yl.EVENT_LOAD_GAMERES_SUCCESS = "EVENT_LOAD_GAMERES_SUCCESS"
yl.EVENT_LOAD_GAMERES_FAILED = "EVENT_LOAD_GAMERES_FAILED"
yl.EVENT_REMOVE_GAME_LOADING = "EVENT_REMOVE_GAME_LOADING"

--大厅奖池更新
yl.EVENT_JACKPORT_UPDATE = "EVENT_JACKPORT_UPDATE"
yl.EVENT_JACKPORT_BIGPRECE = "EVENT_JACKPORT_BIGPRECE"


display.newSprite = function(source, x, y, params)
	
    local spriteClass = cc.Sprite
    local scale9 = false

    if type(x) == "table" and not x.x then
        -- x is params
        params = x
        x = nil
        y = nil
    end

    local params = params or {}
    if params.scale9 or params.capInsets then
        spriteClass = ccui.Scale9Sprite
        scale9 = true
        params.capInsets = params.capInsets or RECT_ZERO
        params.rect = params.rect or RECT_ZERO
    end

    local sprite
    while true do
        -- create sprite
        if not source then
            sprite = spriteClass:create()
            break
        end

        local sourceType = type(source)
        if sourceType == "string" then
            if string.byte(source) == 35 then -- first char is #
                -- create sprite from spriteFrame
                if not scale9 then
                    sprite = spriteClass:createWithSpriteFrameName(string.sub(source, 2))
                else
                    sprite = spriteClass:createWithSpriteFrameName(string.sub(source, 2), params.capInsets)
                end
                break
            end

            -- create sprite from image file
            if display.TEXTURES_PIXEL_FORMAT[source] then
                cc.Texture2D:setDefaultAlphaPixelFormat(display.TEXTURES_PIXEL_FORMAT[source])
            end
            if not scale9 then
                sprite = spriteClass:create(source)
            else
                sprite = spriteClass:create(source, params.rect, params.capInsets)
            end
            if display.TEXTURES_PIXEL_FORMAT[source] then
                cc.Texture2D:setDefaultAlphaPixelFormat(cc.TEXTURE2_D_PIXEL_FORMAT_BGR_A8888)
            end
            break
		elseif sourceType ~= "userdata" then
		
			local error_descr = string.format("display.newSprite() - invalid source type \"%s\"", sourceType)
			pcall(
				function() 
					buglyReportLuaException(error_descr,debug.traceback())
				 end
			)

        else
            sourceType = tolua.type(source)
            if sourceType == "cc.SpriteFrame" then
                if not scale9 then
                    sprite = spriteClass:createWithSpriteFrame(source)
                else
                    sprite = spriteClass:createWithSpriteFrame(source, params.capInsets)
                end
            elseif sourceType == "cc.Texture2D" then
                sprite = spriteClass:createWithTexture(source)
            else
                pcall(
					function() 
						buglyReportLuaException(error_descr,debug.traceback())
					end
				)
            end
        end
        break
    end

    if sprite then
        if x and y then sprite:setPosition(x, y) end
        if params.size then sprite:setContentSize(params.size) end
	else
		local error_descr = string.format("display.newSprite() - create sprite failure, source \"%s\"", tostring(source))
		pcall(
				function() 
					buglyReportLuaException(error_descr,debug.traceback())
				 end
			)
    end

    return sprite
end